﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EGuayas.Web.Resources;
using EntGuayasSLA.BL;
using EntGuayasSLA.BL.Listas.Criterias;
using Ext.Net;

namespace EGuayas.Web.Aspx
{
    public partial class pgAMonit : pgBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!X.IsAjaxRequest)
                {
                    var id = Request["mon_id"];
                    Session[SessionPage.PageGestionAdminAudMonEdit + Constantes.AMonitoreo] = id;
                    Session[SessionPage.PageGestionAdminAudMonEdit + "codFase_" + Constantes.AMonitoreo] = Constantes.AMonitoreo;
                    var ExpedienteId = Request["exp_id"];
                    Session[SessionPage.PageGestionAdminAudMonEdit + Constantes.Expediente] = ExpedienteId;
                    Session[SessionPage.PageGestionAdminAudMonEdit + "FASE_ID_" + Constantes.AMonitoreo] = id;
                    Session[SessionPage.PageGestionAdminAudMonEdit + "_estadoFase" + Constantes.AMonitoreo] = Request["estadoFase"];
                    CloseTabs(TabPanel1,1);
                    var bNotAut = MostrarAlertaFaseNoAutorizada(SessionPage.PageGestionAdminAudMonEdit, Constantes.AMonitoreo, true);
                    if (bNotAut )
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("<div id='a0eebc99-9c0b-4ef8-bb6d-6bb9bd380008-body' class='x-panel-body x-panel-body-default x-panel-body-default x-docked-noborder-top x-docked-noborder-right x-docked-noborder-bottom x-docked-noborder-left' style='width: 1106px; height: 512px; left: 0px; top: 0px;'><center><br>");
                      
                        sb.Append("<div id='main-frame-error'>");
                        sb.Append("<div id='box'>");
                        sb.Append("<div class='read1'>");
                        sb.Append("<div class='read1-img1'>");
                        sb.Append(
                            "<img width='32' height='30' alt='img' src=''>");
                        sb.Append("</div>");
                        sb.Append("<center><h3>" + Titulos.TituloNoAutoriza + "</h3></center>");
                        sb.Append("<p>");
                        sb.Append(Mensajes.MensajeNoAccesoFase1 + " <b>" + Constantes.AMonitoreo + "</b> " +
                                  Mensajes.MensajeNoAccesoFase2);
                        sb.Append("</p>");
                        sb.Append("</div>");
                        sb.Append("</div>");
                        sb.Append("</div>");

                        sb.Append("</center></div>");
                        Response.Write("<html><head>");
                        Response.Write("<link  href='../../../Resources/css/Style.css'  rel='stylesheet' /> ");
                        Response.Write("</head><body>");
                        Response.Write(sb);
                        Response.Write("</body></html>");
                        Response.End();
                    }
                }
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }

        }
   
        #region Documentos Licenciamiento
        /// <summary>
        /// Documentos correguir
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnCorrDocMonAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
            SetCustomConfigWucAllAud(panel, Constantes.AMonitoreo, Valores.Modulo_Archivo_Aud_Moni, SessionPage.PageGestionAdminAudMonEdit, Request["mon_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
        protected void OnTareasAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
            SetCustomConfigWucAllAud(panel, Constantes.AMonitoreo, Valores.Modulo_Tarea_Aud_Moni, SessionPage.PageGestionAdminAudMonEdit, Request["mon_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
        protected void OnInformeAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
                Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
                SetCustomConfigWucAllAud(panel, Constantes.AMonitoreo, Valores.Modulo_Archivo_Informes_Aud_Moni, SessionPage.PageGestionAdminAudMonEdit, Request["mon_id"], Request["exp_id"], Request["exa_id"]);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
      
        #endregion

    }


}